<script type="application/javascript">	
	var arr = new Array();
	$(document).ready(function(){		
		var count = parseInt($('#countTmpMovie').val());
		if(count>0){
			var url = $('#http_path').val()+ "page.php?Type=getprocess&Catch_Id=-1&mv_hdd=-1"+"&hd308="+$('#hd308').val();
			$("#TT_Process").load(url); 
		}
	});	
	
    function check_frm(){       
        return $.trim($('#title').val()) != '';
    };
	
    function GetProcess(Product_Id, quantity){                            		
        var url = $('#http_path').val()+ "page.php?Catch_Id=" + Product_Id + "&mv_hdd=" + quantity+"&hd308="+$('#hd308').val();
		$("#TT_Process").load(url);                               
    }
		           
    function CheckActive(Product_Id){                            
        arr.push(Product_Id);      		   
    }
	    
    function CHeckNotExistedPro(Id){
        for (i = 0; i < arr.length; i++) {
            if (arr[i] == Id) {
                return false;
            }
        }
        return true;
    }
    
    function RemoveArr(Id){
        var removeIndex = -1;
        for (i = 0; i < arr.length; i++) {
            if (arr[i] == Id) {
                removeIndex = i;
                break;
            }
        }        
        if (removeIndex >= 0) {
            arr.splice(removeIndex, 1);
        }        
    }
    
    function AddToCart(Product_Id, quantity){
        //Neu chua click thi set image len
        if (CHeckNotExistedPro(Product_Id) == true) {
            arr.push(Product_Id);                  
        }
        else//Nguoc lai thi bo ra
        {
            RemoveArr(Product_Id);            
        }
		//Set lai image cho phim
		if (document.getElementById("IMG_" + Product_Id).style.display == "none") {
            document.getElementById("IMG_" + Product_Id).style.display = "block";
        }
        else {
            document.getElementById("IMG_" + Product_Id).style.display = "none";
        }
		GetProcess(Product_Id, quantity);        
    }        
</script>
<!-- begin content-->
<div id="content">
	<input type='hidden' id='hd308' value='<?=$_SESSION['hd308']?>'/>	
	<input type='hidden' id='http_path' value='<?=PATH_HTTP?>'/>
    <div class="middle" id="WzTtDiV">
        <table cellspacing="0" border="0" width="100%">
            <tbody>        
            <tr>
            	
                <td align="center">    										               
					<form action="?cc=movie&searchtype=find" name="frmsearch" method="post" enctype="multipart/form-data" onsubmit="return check_frm();">                       						          
                		Tên phim <input type="text" id="title" name="title" value="" title="Tìm kiếm" style="width:400px" >							
                		<input name="search" type="submit" value=" Tìm kiếm">						                    
					</form>					
                </td>
            </tr>        
            <tr>
                <td>
                    <?=$product_movie?>
                </td>
            </tr>
            </tbody>
        </table>        
        <div id="TT_Process">
        </div>        
    </div>
</div>
<!--end content-->
